<?php
declare (strict_types = 1);

namespace app\middleware;

use app\Request;
use Closure;

class Login
{
	/**
	 * 处理请求
	 *
	 * @param Request $request
	 * @param Closure $next
	 * @return mixed
	 */
	public function handle(Request $request, Closure $next)
	{
		if (!$request->user_id){
			writeJson(401,'请登录后操作');
		}
		return $next($request);
	}
}
